import { Flex, Tooltip } from "antd"
import { ColumnGroupType, ColumnType } from "antd/es/table"

import CopyTextButton from "@/components/common/copyTextButton"
import { formatTime, handleNumber, handlePercentage } from "@/utils/util"

const memberFrozenRebate = (
	newFormat: (arg: string) => string,
	_getFromDic: (arg: string, strictlyLabel?: boolean) => any
): Record<string, ColumnGroupType<any> | ColumnType<any>> => ({
	memberFrozenRebate_memberAccount: {
		//
		key: "memberFrozenRebate_memberAccount",
		align: "center",
		dataIndex: "memberAccount",
		title: newFormat("risk.member_account"),
		width: 100,
		render: (memberAccount: string) => <CopyTextButton text={memberAccount} />
	},
	memberFrozenRebate_orderNumber: {
		key: "memberFrozenRebate_orderNumber",
		align: "center",
		dataIndex: "orderNumber",
		title: newFormat("risk.order_number"),
		width: 200,
		render: (orderNumber: string) => <CopyTextButton text={orderNumber} />
	},
	memberFrozenRebate_accountType: {
		//
		key: "memberFrozenRebate_accountType",
		align: "center",
		dataIndex: "accountType",
		title: newFormat("risk.account_type"),
		width: 100
	},
	memberFrozenRebate_belongingMerchant: {
		//
		key: "memberFrozenRebate_belongMerchant",
		align: "center",
		dataIndex: "belongingMerchant",
		title: newFormat("common.belong_merchant"),
		width: 120
	},
	memberFrozenRebate_directAgent: {
		//
		key: "memberFrozenRebate_directAgent",
		align: "center",
		dataIndex: "directAgent",
		title: newFormat("risk.direct_agent"),
		width: 100,
		render: (directAgent: string) => <CopyTextButton text={directAgent} />
	},
	memberFrozenRebate_belongingGeneralAgent: {
		//
		key: "memberFrozenRebate_belongingGeneralAgent",
		align: "center",
		dataIndex: "belongingGeneralAgent",
		title: newFormat("risk.belonging_general_agent"),
		width: 100,
		render: (belongingGeneralAgent: string) => <CopyTextButton text={belongingGeneralAgent} />
	},
	memberFrozenRebate_personalFrozenRebate: {
		//
		key: "memberFrozenRebate_personalFrozenRebate",
		align: "center",
		dataIndex: "rebateAmount",
		title: newFormat("risk.personal_frozen_rebate"),
		width: 100,
		render: (personalFrozenRebate: string, record: any) => handleNumber(record.currency, personalFrozenRebate)
	},
	memberFrozenRebate_frozenRebatePeriod: {
		//
		key: "memberFrozenRebate_frozenRebatePeriod",
		align: "center",
		dataIndex: "frozenRebatePeriod",
		title: newFormat("risk.frozen_rebate_period"),
		width: 100,
		render: (frozenRebatePeriod: string) => formatTime(frozenRebatePeriod)
	},
	////
	memberFrozenRebate_venueName: {
		//\
		key: "memberFrozenRebate_venueName",
		align: "center",
		dataIndex: "venueName",
		title: newFormat("risk.venue_name"),
		width: 100
	},

	memberFrozenRebate_noteNumber: {
		key: "memberFrozenRebate_noteNumber",
		align: "center",
		dataIndex: "noteNumber",
		title: (
			<Flex vertical={false} align="center">
				{newFormat("risk.note_number")}
				<Tooltip placement="top" title={newFormat("risk.note_number_tips")}>
					<div style={{ borderRadius: 999, backgroundColor: "black", width: 20, height: 20 }}>?</div>
				</Tooltip>
			</Flex>
		),
		width: 100,
		render: (noteNumber: string) => <CopyTextButton text={noteNumber} />
	},
	memberFrozenRebate_venue: {
		key: "memberFrozenRebate_venue",
		align: "center",
		dataIndex: "venue",
		title: newFormat("risk.venue"),
		width: 100
	},
	memberFrozenRebate_gameName: {
		key: "memberFrozenRebate_gameName",
		align: "center",
		dataIndex: "gameTypeName",
		title: newFormat("risk.game_name"),
		width: 100
	},
	memberFrozenRebate_bettingTime: {
		key: "memberFrozenRebate_bettingTime",
		align: "center",
		dataIndex: "createAt",
		title: newFormat("risk.betting_time"),
		width: 100,
		render: (bettingTime: string) => formatTime(bettingTime)
	},
	memberFrozenRebate_bettingAmount: {
		key: "memberFrozenRebate_bettingAmount",
		align: "center",
		dataIndex: "bettingAmount",
		title: newFormat("risk.betting_amount"),
		width: 100,
		render: (bettingTime: string) => `$${bettingTime}`
	},
	memberFrozenRebate_validBet: {
		key: "memberFrozenRebate_validBet",
		align: "center",
		dataIndex: "validBetAmount",
		title: (
			<Flex vertical={false} align="center">
				{newFormat("risk.valid_bet")}
				<Tooltip placement="top" title={newFormat("risk.valid_bets_tips")}>
					<div style={{ borderRadius: 999, backgroundColor: "black", width: 20, height: 20 }}>?</div>
				</Tooltip>
			</Flex>
		),
		width: 100,
		render: (validBet: string, record: any) => handleNumber(record.currency, validBet)
	},
	memberFrozenRebate_rebateRatio: {
		key: "memberFrozenRebate_rebateRatio",
		align: "center",
		dataIndex: "rebateRate",
		title: newFormat("risk.rebate_ratio"),
		render: (rebateRatio: string) => handlePercentage(Number(rebateRatio)),
		width: 100
	},
	memberFrozenRebate_rebateAmount: {
		key: "memberFrozenRebate_rebateAmount",
		align: "center",
		dataIndex: "rebateAmount",
		title: newFormat("risk.rebate_amount"),
		width: 100
	},
	memberFrozenRebate_frozenRebateAmount: {
		key: "memberFrozenRebate_frozenRebateAmount",
		align: "center",
		dataIndex: "frozenRebateAmount",
		title: newFormat("risk.frozen_rebate_amount"),
		width: 100,
		render: (frozenRebateAmount: string) => <div style={{ color: "red" }}>{`$${frozenRebateAmount}`}</div>
	}
})
export default memberFrozenRebate
